<?php

class Mageex_ExportPdf_Model_ExportPdf extends Mage_Core_Model_Abstract
{
    public function _construct()
    {
        parent::_construct();
        $this->_init('exportpdf/exportpdf');
    }
	public function getListByType($type)
	{
		$list = array();
		$list[0] = 'Magento Default';
		$templates = $this->getCollection()->addFieldToFilter('used_for', array("like"=>'%'.$type.'%'));
		foreach($templates as $template){
			if($template['status']==1)
				$list[$template['exportpdf_id']] = $template['title'];
		}
		return $list;
	}
	public function getTemplateById($id)
	{	
		$collection = $this->load($id)->getCollection();
		foreach($collection as $_collection){
			if(($id == $_collection->getId()) && ($_collection->getStatus() == 1)){
				
				return $_collection->getData();
			}
		}
	}
}